// connect高阶组件
// 用于把redux中的state数据和方法链接在当前组件中
import { connect } from "react-redux"

import {getHots,getSoon,getVideo} from "./service/https"

const dispatchFn = dispatch=> ({
    getHotArr:async ()=>{
        let ret = await getHots()
        dispatch({type:"HOTARR",data:ret.data.films})
    },
    getSoonArr:async ()=>{
        let ret = await getSoon()
        dispatch({type:"SOONARR",data:ret.data.films})
    },
    getVideoArr:async ()=>{
        let ret = await getVideo()
        dispatch({type:"VIDEOARR",data:ret.data.cinemas})
    }
})

export default connect(state => state, dispatchFn)